package com.dpstudio.plugin.cms;

import com.dpstudio.plugin.cms.document.IProperty;
import com.intellij.lang.Language;
import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import com.intellij.openapi.fileTypes.LanguageFileType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class CmsTypeFactory extends FileTypeFactory {

    public static class CmsLanguage extends Language {
        public static final CmsLanguage INSTANCE = new CmsLanguage();

        private CmsLanguage() {
            super("cms 标签插件");
        }
    }


    public static class CmsFileType extends LanguageFileType {
        public static final CmsFileType INSTANCE = new CmsFileType();

        private CmsFileType() {
            super(CmsLanguage.INSTANCE);
        }

        @NotNull
        @Override
        public String getName() {
            return "cms 标签插件";
        }

        @NotNull
        @Override
        public String getDescription() {
            return "cms 标签插件";
        }

        @NotNull
        @Override
        public String getDefaultExtension() {
            return "cms";
        }

        @Nullable
        @Override
        public Icon getIcon() {
            return IProperty.ICON;
        }
    }

    @Override
    public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
        fileTypeConsumer.consume(CmsFileType.INSTANCE);
    }
}
